home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Workbench / ToolManager / Source / Library / wbstart.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  64 lines

  1. /*
  2.  * wbstart.c  V3.1
  3.  *
  4.  * ToolManager library WB start handling routines
  5.  *
  6.  * Copyright (C) 1990-98 Stefan Becker
  7.  *
  8.  * This source code is for educational purposes only. You may study it
  9.  * and copy ideas or algorithms from it for your own projects. It is
  10.  * not allowed to use any of the source codes (in full or in parts)
  11.  * in other programs. Especially it is not allowed to create variants
  12.  * of ToolManager or ToolManager-like programs from this source code.
  13.  *
  14.  */
  15.  
  16. #include "toolmanager.h"
  17.  
  18. /* Global data */
  19. static struct Library *WBStartBase;
  20.  
  21. #ifdef _DCC
  22. /* Varargs stub */
  23. static LONG WBStartTags(Tag tag1, ...)
  24. {
  25.  return(WBStartTagList((struct TagItem *) &tag1));
  26. }
  27. #endif
  28.  
  29. /* Start a CLI program */
  30. #undef  DEBUGFUNCTION
  31. #define DEBUGFUNCTION StartWBProgram
  32. BOOL StartWBProgram(const char *cmd, const char *cdir, ULONG stack, WORD prio,
  33.                     struct AppMessage *msg)
  34. {
  35.  BOOL rc = FALSE;
  36.  
  37.  WBSTART_LOG(LOG5(Arguments,
  38.                   "Cmd '%s' Dir '%s' Stack %ld Prio %ld Msg 0x%08lx",
  39.                   cmd, cdir, stack, prio, msg))
  40.  
  41.  /* Open wbstart.library */
  42.  if (WBStartBase = OpenLibrary(WBSTART_NAME, WBSTART_VERSION)) {
  43.  
  44.   WBSTART_LOG(LOG1(WBStartBase, "0x%08lx", WBStartBase))
  45.  
  46.   /* Start WB program */
  47.   rc = WBStartTags(WBStart_Name,          cmd,
  48.                    WBStart_DirectoryName, cdir,
  49.                    WBStart_Stack,         stack,
  50.                    WBStart_Priority,      prio,
  51.                    WBStart_ArgumentCount, msg ? msg->am_NumArgs : 0,
  52.                    WBStart_ArgumentList,  msg ? msg->am_ArgList : 0,
  53.                    TAG_DONE)
  54.         == RETURN_OK;
  55.  
  56.   /* Close library */
  57.   CloseLibrary(WBStartBase);
  58.  }
  59.  
  60.  WBSTART_LOG(LOG1(Result, "%ld", rc))
  61.  
  62.  return(rc);
  63. }
  64.